import nci60.data.maxquant.*

def classes =[]

def currentProject = Project.findById(1)

def experiments = Experiment.findAll()
experiments.each(){exp->
    classes.add(exp.name.split("_")[0])
}
def uniqClasses = classes.unique()

def tmpClass
uniqClasses.each(){cls->
    tmpClass = new ExperimentClass([name:cls, currentProject:currentProject])
    tmpClass.save(flush:true)
}

experiments.each(){exp->
    def tmp = exp.name.split("_")[0]
    tmpClass = ExperimentClass.findByName(tmp)
    exp.currentClass = tmpClass
    exp.save(flush:true)
}